Click here to Skip to main content
15,901,205 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi all
i m working on date time picker these days.
i take two datetime picker control,one textbox and a button.
what i want is whenever i entered date in two datetime picker,and entered the button,it will give me the difference between two date and show it in the textbox.
can anybody help me.
thanx in advance
neaS
Posted

Try a TimeSpan[^]:
DateTimePicker startDate;
DateTimePicker endDate;
...
TimeSpan diff = endDate.Value - startDate.Value;
Console.WriteLine(diff.Days);
 
Share this answer
 
Check this[^]


and

This[^]
 
Share this answer
 
Might be helpful,

Difference between two DateTimes C#?[^]

:)
 
Share this answer
 
 
Share this answer
 
Check this link

Difference between two dates[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900